<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Document</title>
</head>
<body>

  <div id='app'>
    <common-head>
    </common-head>
  </div>


<script src='https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js'></script>
<script>
  // 定义局部组件
  const CommonTitle = {
      template: `
        <h3>局部组件 {{ title }}</h3>
      `
      ,data() {
        return {
          title: '局部组件数据'
        }
      }
  }
  const CommonHead = {
    template:`
      <div>
        <h1>公共头部（全局）</h1>
        <common-title></common-title>
      </div>
    `
    ,data(){
      return {
        num: 10
      }
    }
    ,components: {
      CommonTitle
    }
  }
  // 注册全局组件
  Vue.component("CommonHead", CommonHead)
  const app = new Vue({
    el: '#app'
    ,data: {
      msg: 'Hello Vue'
    }
    ,methods: {

    }
  })
</script>
</body>
</html>